package org.atmaca.ert.service;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.atmaca.ert.dao.DbDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

@Service
@Transactional
public class Test {

	@Autowired
	private DbDaoImpl dbDao;

	protected transient Log log = LogFactory.getLog(getClass());

	public void startJobs() throws IOException, IllegalArgumentException,
			FeedException {
		URL url = new URL("http://www.sabah.com.tr/rss/Anasayfa.xml");
		XmlReader xml = new XmlReader(url);

		SyndFeedInput input = new SyndFeedInput();

		SyndFeed build = input.build(xml);
		List<SyndEntryImpl> entries = build.getEntries();
		SyndEntryImpl entry = entries.get(0);

	}

	public static void main(String[] args) throws IllegalArgumentException,
			IOException, FeedException {
		new Test().startJobs();
	}

}
